package com.goldze.mvvmhabit.ui.card;

import android.graphics.drawable.Drawable;

import com.goldze.mvvmhabit.R;
import com.goldze.mvvmhabit.entity.CartInfoEntity;
import com.goldze.mvvmhabit.widght.swiperv.SwipeViewModel;

import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.databinding.ObservableField;
import me.goldze.mvvmhabit.base.ItemViewModel;

public class CartItemTestViewModel extends ItemViewModel<CardViewModel> implements SwipeViewModel {
    private boolean pinned = false;
    public Drawable drawable;
    private int index;
    private int type;
    public ObservableField<CartInfoEntity.NoProductsManjian> observableField = new ObservableField<CartInfoEntity.NoProductsManjian>();
    public CartItemTestViewModel(@NonNull CardViewModel viewModel, CartInfoEntity.NoProductsManjian cartProducts, int index) {
        super(viewModel);
        observableField.set(cartProducts);
        drawable = ContextCompat.getDrawable(viewModel.getApplication(), R.drawable.img_default);
        this.index = index;
    }

    @Override
    public void setPinned(boolean pinned) {
        this.pinned =pinned;
    }

    @Override
    public boolean isPinned() {
        return pinned;
    }

    @Override
    public long getId() {
        return index;
    }

    @Override
    public void setSwipeType(int type) {
        this.type = type;
    }

    @Override
    public int getSwipeType() {
        return type;
    }
}
